package com.qk.mapper;

import com.qk.entity.Dept;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface DeptMapper {
    //3. 添加部门
    @Insert("insert into dept( name, status, create_time, update_time) values(#{name},#{status},#{createTime},#{updateTime})")
    void insert(Dept dept);
    //1. 部门列表查询
    List<Dept> selectList(String name, Integer status);
    //4. 根据ID查询
    @Select("select id, name, status, create_time, update_time from dept where id = #{id}")
    Dept selectById(Integer id);
    //5. 修改部门
    void update(Dept dept);
   //2. 删除部门
    @Delete("delete from dept where id = #{id}")
    void deleteById(Integer id);
    //6. 查询所有部门
    @Select("select id, name, status, create_time, update_time from dept where status = 1")
    List<Dept> selectAll();
}
